const path = require("path");
module.exports = {
  entry: "./index.js",
  output: {
    filename: "unit.js",
    path: path.resolve(__dirname, "dist"),
    // 向外暴露的对象的名称
    library: "su",
    // 打包生成库可以通过esm/ commonjs / require的语法引入
    libraryTarget: "umd",
    clean: true,
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env"],
          },
        },
      },
    ],
  },
  mode: "development",
};
